<?php
//подключаем функции и настройки, коннектимся к базе
require $_SERVER['DOCUMENT_ROOT']."/prjconf/index.php";

header('Content-type: text/html; charset="windows-1251"',true);
setlocale(LC_ALL, 'ru_RU');

 foreach($_POST as $key => $value) {
 	$_POST[$key] = iconv('UTF-8', 'windows-1251', $value);
 }//foreach
 
 

	?>
<div class="pop-box">
	<div class="razdel-blog">текущий раздел: «<b>Заметки</b>»</div>



<?php	
		$rname="blog";
		$rname_url="blog";
		//$pagenav=1;
		
		$CatID="";
		
		$limit[0]=0;
		$limit[1]=3;
		
		$order="- newdate";
		
		//$numall=GetElementsByCatID($rname, $CatID);
		//if (!empty($numall)) $numall=count($numall);
		
		$NewsData = GetElementsByCatID($rname, $CatID, $order, $limit);
	
	
	if (!empty($NewsData)) {
		?>
		<h1>Заметки</h1>
		<?php
		
		//print_r($NewsData);
		
		foreach ($NewsData as $News) {
			//if (!empty($News['uname'])) $NewURL="/news/".$News['uname'].".html";
			//else $NewURL="/news/".$News['ID'].".html";
			
			//if (empty($News['nimg'])) $News['nimg']="resources/news/30_nimg.jpg";
			
			if (!empty($News['uname'])) $NewURL="#";
			else $NewURL="#";
			
			//$URLname = str_replace("#", "", $NewURL);
			$URLname = "/ajax/blog.php";
			
			$onclick="TINY.box.show({url:'".$URLname."',post:'id=".$News['ID']."',width:700,height:600})";
			
			
						if (!empty($News['icon'])) {
				
							$img_array=string_to_array($News['icon']);
							$News['icon']=$img_array[0];
					
							$width="115";
							$height="70";
							
							$src=$News['icon'];
							$dest=str_replace(".", "_index.", $News['icon']);
							$rgb="";
							//echo "src=".$src."<br>";
							//echo "dest=".$dest."<br>";
							//if (!file_exists($dest)) 
							$rgb="";
							$do=img_resize($src, $dest, $width, $height, $rgb);
							$dest="/".$dest;
							
						}//if
						else $dest=$design_path."images/dot.gif";
			
			
		?>
		<div class="s-new">
			
			<div class="s-img">
				<a href="<?php echo $NewURL?>" onclick="<?php echo $onclick; ?>">
				<img class="thumb" src="<?php echo $dest;?>" width="<?php echo $width;?>" height="<?php echo $height;?>" alt="<?php echo $News['title']?>" />
				</a>
			</div>
			
			<div class="s-intro">
				<a class="s-title" href="<?php echo $NewURL?>" onclick="<?php echo $onclick; ?>" ><?php echo $News['title']?></a>
				<div class="m-date"><?=mydate($News['newdate'], 8);?></div>
			</div>
			
			<div class="clear"></div>
		</div>
		<?php
		}//foreach ($NewsData as $News) {
		?>
		
		<div class="clear"></div>
	<?php
	}//if (!empty($NewsData)) {
	else echo "В выбранной Вами категории пресс-релизов не обнаружено.";
	?>





</div>
<?php

?>